var AssignUtil = {
    assignToUser : function(taskId, succCall){
        dialogOpenPageConfirm('分派用户', '/static/bflow/ui/define/assignUserList.html?singleSelect=true', 700, 400, function () {
            //confirm
            var iframe = $(document).find(".jconfirm-content iframe")[0].contentWindow;
            var userArray = iframe.retSelect();
            if(userArray == null || userArray.length <= 0){
                dialogTipWarn("请选择分派人员","warn")
                return false;
            } else if(userArray != null && userArray.length > 1){
                dialogTipWarn("只能选择一个分派人员","warn")
                return false;
            } else{
                log("开始分派 :" + JSON.stringify(userArray[0]));
                HttpUtil.ajaxAsyncJsonPost("/bflow/task/assignToUser", {taskId: taskId, userId: userArray[0].userId}, function(message){
                    dialogTipSuccess(message);
                    if(typeof succCall == 'function'){
                        log("1111");
                        succCall();
                    }
                });
                return true; //false则窗口不关闭
            }
        }, function () {
            //init
        });
    },
    transferToUser : function(taskId, succCall){
        dialogOpenPageConfirm('转交用户', '/static/bflow/ui/define/assignUserList.html?singleSelect=true', 700, 400, function () {
            //confirm
            var iframe = $(document).find(".jconfirm-content iframe")[0].contentWindow;
            var userArray = iframe.retSelect();
            if(userArray == null || userArray.length <= 0){
                dialogTipWarn("请选择转交人员","warn")
                return false;
            } else if(userArray != null && userArray.length > 1){
                dialogTipWarn("只能选择一个转交人员","warn")
                return false;
            } else{
                log("开始转交 :" + JSON.stringify(userArray[0]));
                dialogPrompt("填写转交备注","转交备注",function(remarks){
                    HttpUtil.ajaxAsyncJsonPost("/bflow/task/transferToUser", {taskId: taskId, userId: userArray[0].userId,remarks:remarks}, function(message){
                        dialogTipSuccess(message);
                        if(typeof succCall == 'function'){
                            succCall();
                        }
                    });
                    return true; //false则窗口不关闭
                },"textarea");
            }
        }, function () {
            //init
        });
    },
}